@extends('layouts.home')
@extends('layouts.nav')
@extends('layouts.top')

@section('heading')
    <h3>
        教师管理
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">教师管理</a>
        </li>
        <li class="active"> 教师新增</li>
    </ul>
@endsection


@section('wrapper')
    <section class="panel">

        <div class="panel-body">
            <div class=" form">
                @if(isset($teacher))
                    <form method="POST" action="{{ route('teacher.update', $teacher->id) }}" class="cmxform form-horizontal adminex-form">
                        {{ method_field('PATCH') }}
                @else
                    <form method="POST" action="{{ route('teacher.store') }}" class="cmxform form-horizontal adminex-form">
                @endif
                    @csrf
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">名称</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('name') ? ' error' : '' }}" id="cname" value="{{ $teacher->name or old('name') }}" name="name" minlength="2" type="text"/>
                            @if ($errors->has('name'))
                                <label class="error">{{ $errors->first('name') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group ">
                        <label for="cname" class="control-label col-lg-2">电话</label>
                        <div class="col-lg-5">
                            <input class=" form-control{{ $errors->has('tel') ? ' error' : '' }}" id="ctel" value="{{ $teacher->tel or old('tel') }}" name="tel" minlength="2" type="text"/>
                            @if ($errors->has('tel'))
                                <label class="error">{{ $errors->first('tel') }}</label>
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">简介</label>
                        <div class="col-sm-10" id="div1">
                            @include('UEditor::head')
                            <script id="container" name="remark" type="text/plain">
                                {!! $teacher->remark or old('remark') !!}
                            </script>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button class="btn btn-primary" type="submit">保存</button>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </section>
@endsection

@section('js')
    <script type="text/javascript">
        var ue = UE.getEditor('container');
        ue.ready();
    </script>
    <script type="text/javascript" src="{{ asset('files/js/bootstrap-fileupload.min.js') }}"></script>
@endsection